package org.huangrui.javase;

/**
 * @Author hr
 * @Create 2025-11-06 15:17
 **/
public class T11MemberVarOrLocal {
    static int s;//成员变量,类变量
    int i;//成员变量,实例变量
    int j;//成员变量,实例变量
    {
        int i = 1; //非静态代码块的局部变量 i
        i++;
        j++;
        s++;
    }
    public void test(int j){//形参,局部变量 j
        j++;
        i++;
        s++;
    }
    public static void main(String[] args) {//形参，局部变量，args
        T11MemberVarOrLocal obj1 = new T11MemberVarOrLocal();//局部变量 obj1
        T11MemberVarOrLocal obj2 = new T11MemberVarOrLocal();//局部变量 obj2
        obj1.test(10); //2 1 3
        obj1.test(20); //2 1 4
        obj2.test(30); //1 1 5
        System.out.println(obj1.i + "," + obj1.j + "," + obj1.s);
        System.out.println(obj2.i + "," + obj2.j + "," + obj2.s);
    }
}
